<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/public/inc/tags.jsp"%>
<input type="hidden" value="${model.versionid}" name="versionid">
<div class="form-horizontal">
    <div class="form-group">
        <label class="control-label col-md-2">版本号</label>
        <div class="col-md-10">
            <input type="text" id="versioncode" name="versioncode" class="form-control" placeholder="请输入版本号"
                   value="${model.versioncode}"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">版本的URL地址</label>
        <div class="col-md-10">
            <input type="text" id="url" name="url" class="form-control" placeholder="请输入版本的URL地址"
                   value="${model.url}"/>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">是否强制更新</label>
        <div class="col-md-10">
            <select name="forced_update" class="form-control">
                <option value="0" <c:if test="${model.forced_update==0}"> selected="selected"</c:if>>否
                </option>
                <option value="1" <c:if test="${model.forced_update==1}"> selected="selected"</c:if>>是
                </option>
            </select>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-md-2">内容</label>
        <div class="col-md-10">
            <textarea id="content" name="content" style="width:100%;height: 60px">${model.content}</textarea>
        </div>
    </div>
</div>
<div class="form-group">
    <div class="col-md-offset-2 col-md-10">
        <button type="submit" class="btn btn-primary">
            <i class="fa fa-floppy-o"></i> 保存
        </button>
    </div>
</div>
<jsp:include page="/public/inc/ueditor.jsp"/>
<script type="text/javascript">
    $(document).ready(function () {
        UE.getEditor('content');

        $("#form1").bootstrapValidator({
            feedbackIcons: {
                valid: 'glyphicon glyphicon-ok',
                invalid: 'glyphicon glyphicon-remove',
                validating: 'glyphicon glyphicon-refresh'
            },
            fields: {
                channeid: {
                    validators: {
                        notEmpty: {
                            message: '不能为空'
                        },
                        stringLength: {
                            max: 20,
                            message: '长度过长'
                        },
                        regexp: {
                            regexp: /^\+?(0|[1-9][0-9]*)$/,
                            message: '非负整数'
                        }
                    }
                },
                url: {
                    validators: {
                        stringLength: {
                            max: 500,
                            message: '长度过长'
                        }

                    }
                },
                forced_update: {
                    validators: {
                        regexp: {
                            regexp: /^[0-1]*$/,
                            message: '必须选择是或否中的一个'
                        }
                    }
                },
                versioncode: {
                    validators: {
                        regexp: {
                            regexp: /\d+(\.\d+)*/,
                            message: '请输入正确格式型如：1.1,1.1.2，1111'
                        }
                    }
                }
            }
        });
    });
</script>